package cn.edu.nuc.creditSystem.service.user.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.nuc.creditSystem.bean.user.Role;
import cn.edu.nuc.creditSystem.dao.BaseMapper;
import cn.edu.nuc.creditSystem.dao.user.inf.RoleMapper;
import cn.edu.nuc.creditSystem.service.BaseImpl;
import cn.edu.nuc.creditSystem.service.user.service.RoleService;
@Service
public class RoleImpl extends BaseImpl<Role> implements RoleService{
	@Autowired
	private RoleMapper rm;
	@Override
	public BaseMapper<Role> getBaseDao() {
		return rm;
	}
	@Override
	@Transactional
	public int updateRole(Role role) {
		if(role.getMenuIds()!=null && !"".equals(role.getMenuIds())){
			rm.deleteMenu(role.getId());
			rm.updateMenu(role);
			return 1;
		}
		return rm.update(role);
	}

}
